package initialize

import (
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
	"log"
	"os"
)

func InitLogger() {

	//zapLogger, err := zap.NewDevelopment()
	//
	//if err != nil {
	//	log.Fatal("日志初始化失败，", err)
	//}

	// 创建一个自定义的日志记录器
	encoderConfig := zap.NewProductionEncoderConfig()
	encoder := zapcore.NewConsoleEncoder(encoderConfig)
	core := zapcore.NewCore(encoder, zapcore.Lock(os.Stdout), zapcore.InfoLevel)
	logger := zap.New(core)

	zap.ReplaceGlobals(logger)
	log.Print("日志初始化成功!")

}
